package com.baosaas.api.baseInfo.service.impl;

import com.alibaba.fastjson.JSON;
import com.baosaas.api.baseInfo.dao.SystemMapper;
import com.baosaas.api.baseInfo.service.SystemService;
import com.baosaas.api.baseInfo.util.HttpPostConnect;
import com.baosaas.api.baseInfo.util.PropertiesUtil;
import com.baosaas.api.baseInfo.util.RequestUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.stereotype.Service;

import java.util.HashMap;

@Service("systemService")
@EnableScheduling
@SuppressWarnings("all")
public class SystemServiceImpl implements SystemService {
    private static String SYS_DEPT_ID = PropertiesUtil.read("equipment").get("deptId").toString();// "0301";
    // private static String SYS_DEPT_ID1 =
    // PropertiesUtil.read("equipment").get("deptId1").toString();//"5J01";

    @Autowired
    private SystemMapper systemMapper;

    @Override
    public String queryCarList(String deptId, String requestType) {
        System.out.println("获取车辆列表---开始");
        HashMap<String, String> map = new HashMap<>();
        map.put("deptId", deptId);
        map.put("requestType", requestType);
        map.put("startDate", "");
        map.put("endDate", "");
        String address = PropertiesUtil.read("equipment").get("address").toString();
        String result = null;
        try {
            result = HttpPostConnect.simplePostJson(address, JSON.toJSONString(RequestUtils.getHeader("GetVehicles")), JSON.toJSONString(map));
        } catch (Exception e) {
            System.out.print(e.getMessage());
            map.clear();
            map.put("resultFlag", "0");
            map.put("resultMemo", "获取场内车辆列表异常");
            result = JSON.toJSONString(result);
        }
        return result;
    }

}
